
sudo apt-get update
sudo apt-get -y install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io

#加入docker用户组，这样以后用docker就不需要sudo
## 如果直接用vscode命令行执行下面的命令，可以执行成功，但是由于vscode的缓存，会导致vscode命令行还是无法直接用docker命令
## 此时要删除.vscode目录，重新用vscode远程登录，即可重新安装vscode服务，之后就能直接用docker了
sudo usermod -aG docker $USER && newgrp docker




